<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>version - Perl extension for Version Objects - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/version">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="version.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/version">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/version">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/version">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/version">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/version">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/version">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/version">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/version">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/version">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/version">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/version">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/version">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/version">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/version">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/version">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/version">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/version">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/version">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/version">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/version">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/version">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/version">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/version">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/version">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/version">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/version">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/version">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/version">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/version">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/version">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/version">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/version">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/version">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/version">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/version">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/version">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/version">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/version">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/version">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/version">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/version">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/version">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/version">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/version">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/version">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/version">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/version">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/version">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/version">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/version">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/version">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/version">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/version">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/version">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/version">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/version">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/version">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/version">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/version">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/version">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/version">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/version">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/version">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/version">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/version">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/version">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/version">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/version">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/version">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/version">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/version">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/version">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/version">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/version">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/version">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/version">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/version">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/version">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/version">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/version">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="version.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/version">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/version">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/version">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/version">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/version">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/version">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/version">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/version">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/version">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/version">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/version">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/version">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/version">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/version">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/version">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/version">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/version">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/version">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/version">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/version">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/version">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/version">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/version">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/version">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/version">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/version">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/version">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/version">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/version">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/version">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/version">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/version">5.35.1</a>
          <a class="dropdown-item active" href="version.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="version.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="version.html">version</a>
          <div id="more">
            (<a href="version.txt">source</a>,
            <a href="https://metacpan.org/pod/version">CPAN</a>)
          </div>
            <div id="moduleversion">version 0.9928</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="version.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#TYPES-OF-VERSION-OBJECTS">TYPES OF VERSION OBJECTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#DECLARING-VERSIONS">DECLARING VERSIONS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="version.html#How-to-convert-a-module-from-decimal-to-dotted-decimal">How to convert a module from decimal to dotted-decimal</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#How-to-declare()-a-dotted-decimal-version">How to declare() a dotted-decimal version</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="version.html#PARSING-AND-COMPARING-VERSIONS">PARSING AND COMPARING VERSIONS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="version.html#How-to-parse()-a-version">How to parse() a version</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#How-to-check-for-a-legal-version-string">How to check for a legal version string</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#How-to-compare-version-objects">How to compare version objects</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="version.html#OBJECT-METHODS">OBJECT METHODS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="version.html#is_alpha()">is_alpha()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#is_qv()">is_qv()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#normal()">normal()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#numify()">numify()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#stringify()">stringify()</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="version.html#EXPORTED-FUNCTIONS">EXPORTED FUNCTIONS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="version.html#qv()">qv()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#is_lax()1">is_lax()</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#is_strict()1">is_strict()</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="version.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="version.html#SEE-ALSO">SEE ALSO</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="version.html#NAME">#</a>NAME</h1>

<p>version - Perl extension for Version Objects</p>

<h1 id="SYNOPSIS"><a class="permalink" href="version.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code># Parsing version strings (decimal or dotted-decimal)

use version 0.77; # get latest bug-fixes and API
$ver = version-&gt;parse($string)

# Declaring a dotted-decimal $VERSION (keep on one line!)

use version; our $VERSION = version-&gt;declare(&quot;v1.2.3&quot;); # formal
use version; our $VERSION = qv(&quot;v1.2.3&quot;);               # deprecated
use version; our $VERSION = qv(&quot;v1.2_3&quot;);               # deprecated

# Declaring an old-style decimal $VERSION (use quotes!)

our $VERSION = &quot;1.0203&quot;;                                # recommended
use version; our $VERSION = version-&gt;parse(&quot;1.0203&quot;);   # formal
use version; our $VERSION = version-&gt;parse(&quot;1.02_03&quot;);  # alpha

# Comparing mixed version styles (decimals, dotted-decimals, objects)

if ( version-&gt;parse($v1) == version-&gt;parse($v2) ) {
  # do stuff
}

# Sorting mixed version styles

@ordered = sort { version-&gt;parse($a) &lt;=&gt; version-&gt;parse($b) } @list;</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="version.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>Version objects were added to Perl in 5.10. This module implements version objects for older version of Perl and provides the version object API for all versions of Perl. All previous releases before 0.74 are deprecated and should not be used due to incompatible API changes. Version 0.77 introduces the new &#39;parse&#39; and &#39;declare&#39; methods to standardize usage. You are strongly urged to set 0.77 as a minimum in your code, e.g.</p>

<pre><code>use version 0.77; # even for Perl v.5.10.0</code></pre>

<h1 id="TYPES-OF-VERSION-OBJECTS"><a class="permalink" href="version.html#TYPES-OF-VERSION-OBJECTS">#</a><a id="TYPES"></a>TYPES OF VERSION OBJECTS</h1>

<p>There are two different types of version objects, corresponding to the two different styles of versions in use:</p>

<dl>

<dt id="Decimal-Versions"><a class="permalink" href="version.html#Decimal-Versions">#</a><a id="Decimal"></a>Decimal Versions</dt>
<dd>

<p>The classic floating-point number $VERSION. The advantage to this style is that you don&#39;t need to do anything special, just type a number into your source file. Quoting is recommended, as it ensures that trailing zeroes (&quot;1.50&quot;) are preserved in any warnings or other output.</p>

</dd>
<dt id="Dotted-Decimal-Versions"><a class="permalink" href="version.html#Dotted-Decimal-Versions">#</a><a id="Dotted"></a>Dotted Decimal Versions</dt>
<dd>

<p>The more modern form of version assignment, with 3 (or potentially more) integers separated by decimal points (e.g. v1.2.3). This is the form that Perl itself has used since 5.6.0 was released. The leading &#39;v&#39; is now strongly recommended for clarity, and will throw a warning in a future release if omitted. A leading &#39;v&#39; character is required to pass the <a href="version.html#is_strict%28%29">&quot;is_strict()&quot;</a> test.</p>

</dd>
</dl>

<h1 id="DECLARING-VERSIONS"><a class="permalink" href="version.html#DECLARING-VERSIONS">#</a><a id="DECLARING"></a>DECLARING VERSIONS</h1>

<p>If you have a module that uses a decimal $VERSION (floating point), and you do not intend to ever change that, this module is not for you. There is nothing that version.pm gains you over a simple $VERSION assignment:</p>

<pre><code>our $VERSION = &quot;1.02&quot;;</code></pre>

<p>Since Perl v5.10.0 includes the version.pm comparison logic anyways, you don&#39;t need to do anything at all.</p>

<h2 id="How-to-convert-a-module-from-decimal-to-dotted-decimal"><a class="permalink" href="version.html#How-to-convert-a-module-from-decimal-to-dotted-decimal">#</a><a id="How"></a>How to convert a module from decimal to dotted-decimal</h2>

<p>If you have used a decimal $VERSION in the past and wish to switch to a dotted-decimal $VERSION, then you need to make a one-time conversion to the new format.</p>

<p><b>Important Note</b>: you must ensure that your new $VERSION is numerically greater than your current decimal $VERSION; this is not always obvious. First, convert your old decimal version (e.g. 1.02) to a normalized dotted-decimal form:</p>

<pre><code>$ perl -Mversion -e &#39;print version-&gt;parse(&quot;1.02&quot;)-&gt;normal&#39;
v1.20.0</code></pre>

<p>Then increment any of the dotted-decimal components (v1.20.1 or v1.21.0).</p>

<h2 id="How-to-declare()-a-dotted-decimal-version"><a class="permalink" href="version.html#How-to-declare()-a-dotted-decimal-version">#</a><a id="How1"></a><a id="How-to-declare-a-dotted-decimal-version"></a>How to <code>declare()</code> a dotted-decimal version</h2>

<pre><code>use version; our $VERSION = version-&gt;declare(&quot;v1.2.3&quot;);</code></pre>

<p>The <code>declare()</code> method always creates dotted-decimal version objects. When used in a module, you <b>must</b> put it on the same line as &quot;use version&quot; to ensure that $VERSION is read correctly by PAUSE and installer tools. You should also add &#39;version&#39; to the &#39;configure_requires&#39; section of your module metadata file. See instructions in <a href="./ExtUtils::MakeMaker.html">ExtUtils::MakeMaker</a> or <a href="./Module::Build.html">Module::Build</a> for details.</p>

<p><b>Important Note</b>: Even if you pass in what looks like a decimal number (&quot;1.2&quot;), a dotted-decimal will be created (&quot;v1.200.0&quot;). To avoid confusion or unintentional errors on older Perls, follow these guidelines:</p>

<ul>

<li><p>Always use a dotted-decimal with (at least) three components</p>

</li>
<li><p>Always use a leading-v</p>

</li>
<li><p>Always quote the version</p>

</li>
</ul>

<p>If you really insist on using version.pm with an ordinary decimal version, use <code>parse()</code> instead of declare. See the <a href="version.html#PARSING-AND-COMPARING-VERSIONS">&quot;PARSING AND COMPARING VERSIONS&quot;</a> for details.</p>

<p>See also <a href="./version::Internals.html">version::Internals</a> for more on version number conversion, quoting, calculated version numbers and declaring developer or &quot;alpha&quot; version numbers.</p>

<h1 id="PARSING-AND-COMPARING-VERSIONS"><a class="permalink" href="version.html#PARSING-AND-COMPARING-VERSIONS">#</a><a id="PARSING"></a>PARSING AND COMPARING VERSIONS</h1>

<p>If you need to compare version numbers, but can&#39;t be sure whether they are expressed as numbers, strings, v-strings or version objects, then you should use version.pm to parse them all into objects for comparison.</p>

<h2 id="How-to-parse()-a-version"><a class="permalink" href="version.html#How-to-parse()-a-version">#</a><a id="How2"></a><a id="How-to-parse-a-version"></a>How to <code>parse()</code> a version</h2>

<p>The <code>parse()</code> method takes in anything that might be a version and returns a corresponding version object, doing any necessary conversion along the way.</p>

<ul>

<li><p>Dotted-decimal: bare v-strings (v1.2.3) and strings with more than one decimal point and a leading &#39;v&#39; (&quot;v1.2.3&quot;); NOTE you can technically use a v-string or strings with a leading-v and only one decimal point (v1.2 or &quot;v1.2&quot;), but you will confuse both yourself and others.</p>

</li>
<li><p>Decimal: regular decimal numbers (literal or in a string)</p>

</li>
</ul>

<p>Some examples:</p>

<pre><code>$variable   version-&gt;parse($variable)
---------   -------------------------
1.23        v1.230.0
&quot;1.23&quot;      v1.230.0
v1.23       v1.23.0
&quot;v1.23&quot;     v1.23.0
&quot;1.2.3&quot;     v1.2.3
&quot;v1.2.3&quot;    v1.2.3</code></pre>

<p>See <a href="./version::Internals.html">version::Internals</a> for more on version number conversion.</p>

<h2 id="How-to-check-for-a-legal-version-string"><a class="permalink" href="version.html#How-to-check-for-a-legal-version-string">#</a><a id="How3"></a>How to check for a legal version string</h2>

<p>If you do not want to actually create a full blown version object, but would still like to verify that a given string meets the criteria to be parsed as a version, there are two helper functions that can be employed directly:</p>

<dl>

<dt id="is_lax()"><a class="permalink" href="version.html#is_lax()">#</a><a id="is_lax"></a><code>is_lax()</code></dt>
<dd>

<p>The lax criteria corresponds to what is currently allowed by the version parser. All of the following formats are acceptable for dotted-decimal formats strings:</p>

<pre><code class="plaintext">v1.2
1.2345.6
v1.23_4
1.2345
1.2345_01</code></pre>

</dd>
<dt id="is_strict()"><a class="permalink" href="version.html#is_strict()">#</a><a id="is_strict"></a><code>is_strict()</code></dt>
<dd>

<p>If you want to limit yourself to a much more narrow definition of what a version string constitutes, <code>is_strict()</code> is limited to version strings like the following list:</p>

<pre><code class="plaintext">v1.234.5
2.3456</code></pre>

</dd>
</dl>

<p>See <a href="./version::Internals.html">version::Internals</a> for details of the regular expressions that define the legal version string forms, as well as how to use those regular expressions in your own code if <code>is_lax()</code> and <code>is_strict()</code> are not sufficient for your needs.</p>

<h2 id="How-to-compare-version-objects"><a class="permalink" href="version.html#How-to-compare-version-objects">#</a><a id="How4"></a>How to compare version objects</h2>

<p>Version objects overload the <code>cmp</code> and <code>&lt;=&gt;</code> operators. Perl automatically generates all of the other comparison operators based on those two so all the normal logical comparisons will work.</p>

<pre><code>if ( version-&gt;parse($v1) == version-&gt;parse($v2) ) {
  # do stuff
}</code></pre>

<p>If a version object is compared against a non-version object, the non-object term will be converted to a version object using <code>parse()</code>. This may give surprising results:</p>

<pre><code>$v1 = version-&gt;parse(&quot;v0.95.0&quot;);
$bool = $v1 &lt; 0.94; # TRUE since 0.94 is v0.940.0</code></pre>

<p>Always comparing to a version object will help avoid surprises:</p>

<pre><code>$bool = $v1 &lt; version-&gt;parse(&quot;v0.94.0&quot;); # FALSE</code></pre>

<p>Note that &quot;alpha&quot; version objects (where the version string contains a trailing underscore segment) compare as less than the equivalent version without an underscore:</p>

<pre><code>$bool = version-&gt;parse(&quot;1.23_45&quot;) &lt; version-&gt;parse(&quot;1.2345&quot;); # TRUE</code></pre>

<p>See <a href="./version::Internals.html">version::Internals</a> for more details on &quot;alpha&quot; versions.</p>

<h1 id="OBJECT-METHODS"><a class="permalink" href="version.html#OBJECT-METHODS">#</a><a id="OBJECT"></a>OBJECT METHODS</h1>

<h2 id="is_alpha()"><a class="permalink" href="version.html#is_alpha()">#</a><a id="is_alpha"></a>is_alpha()</h2>

<p>True if and only if the version object was created with a underscore, e.g.</p>

<pre><code>version-&gt;parse(&#39;1.002_03&#39;)-&gt;is_alpha;  # TRUE
version-&gt;declare(&#39;1.2.3_4&#39;)-&gt;is_alpha; # TRUE</code></pre>

<h2 id="is_qv()"><a class="permalink" href="version.html#is_qv()">#</a><a id="is_qv"></a>is_qv()</h2>

<p>True only if the version object is a dotted-decimal version, e.g.</p>

<pre><code>version-&gt;parse(&#39;v1.2.0&#39;)-&gt;is_qv;       # TRUE
version-&gt;declare(&#39;v1.2&#39;)-&gt;is_qv;       # TRUE
qv(&#39;1.2&#39;)-&gt;is_qv;                      # TRUE
version-&gt;parse(&#39;1.2&#39;)-&gt;is_qv;          # FALSE</code></pre>

<h2 id="normal()"><a class="permalink" href="version.html#normal()">#</a><a id="normal"></a>normal()</h2>

<p>Returns a string with a standard &#39;normalized&#39; dotted-decimal form with a leading-v and at least 3 components.</p>

<pre><code>version-&gt;declare(&#39;v1.2&#39;)-&gt;normal;  # v1.2.0
version-&gt;parse(&#39;1.2&#39;)-&gt;normal;     # v1.200.0</code></pre>

<h2 id="numify()"><a class="permalink" href="version.html#numify()">#</a><a id="numify"></a>numify()</h2>

<p>Returns a value representing the object in a pure decimal.</p>

<pre><code>version-&gt;declare(&#39;v1.2&#39;)-&gt;numify;  # 1.002000
version-&gt;parse(&#39;1.2&#39;)-&gt;numify;     # 1.200</code></pre>

<h2 id="stringify()"><a class="permalink" href="version.html#stringify()">#</a><a id="stringify"></a>stringify()</h2>

<p>Returns a string that is as close to the original representation as possible. If the original representation was a numeric literal, it will be returned the way perl would normally represent it in a string. This method is used whenever a version object is interpolated into a string.</p>

<pre><code>version-&gt;declare(&#39;v1.2&#39;)-&gt;stringify;    # v1.2
version-&gt;parse(&#39;1.200&#39;)-&gt;stringify;     # 1.2
version-&gt;parse(1.02_30)-&gt;stringify;     # 1.023</code></pre>

<h1 id="EXPORTED-FUNCTIONS"><a class="permalink" href="version.html#EXPORTED-FUNCTIONS">#</a><a id="EXPORTED"></a>EXPORTED FUNCTIONS</h1>

<h2 id="qv()"><a class="permalink" href="version.html#qv()">#</a><a id="qv"></a>qv()</h2>

<p>This function is no longer recommended for use, but is maintained for compatibility with existing code. If you do not want to have it exported to your namespace, use this form:</p>

<pre><code>use version 0.77 ();</code></pre>

<h2 id="is_lax()1"><a class="permalink" href="version.html#is_lax()1">#</a><a id="is_lax1"></a>is_lax()</h2>

<p>(Not exported by default)</p>

<p>This function takes a scalar argument and returns a boolean value indicating whether the argument meets the &quot;lax&quot; rules for a version number. Leading and trailing spaces are not allowed.</p>

<h2 id="is_strict()1"><a class="permalink" href="version.html#is_strict()1">#</a><a id="is_strict1"></a>is_strict()</h2>

<p>(Not exported by default)</p>

<p>This function takes a scalar argument and returns a boolean value indicating whether the argument meets the &quot;strict&quot; rules for a version number. Leading and trailing spaces are not allowed.</p>

<h1 id="AUTHOR"><a class="permalink" href="version.html#AUTHOR">#</a>AUTHOR</h1>

<p>John Peacock &lt;jpeacock@cpan.org&gt;</p>

<h1 id="SEE-ALSO"><a class="permalink" href="version.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p><a href="./version::Internals.html">version::Internals</a>.</p>

<p><a href="perl.html">perl</a>.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
